<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="renderer" content="webkit|ie-comp|ie-stand">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1.0,maximum-scale=1.0,user-scalable=no" />
<meta http-equiv="Cache-Control" content="no-siteapp" />
<!--[if lt IE 9]>
<script type="text/javascript" src="lib/html5shiv.js"></script>
<script type="text/javascript" src="lib/respond.min.js"></script>
<![endif]-->
<link rel="stylesheet" type="text/css" href="static/h-ui/css/H-ui.min.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/H-ui.admin.css" />
<link rel="stylesheet" type="text/css" href="lib/Hui-iconfont/1.0.8/iconfont.css" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/skin/default/skin.css" id="skin" />
<link rel="stylesheet" type="text/css" href="static/h-ui.admin/css/style.css" />
<!--[if IE 6]>
<script type="text/javascript" src="lib/DD_belatedPNG_0.0.8a-min.js" ></script>
<link rel="stylesheet" href="design/css/layui.css">
<script src="design/layui.js"></script>
<script>DD_belatedPNG.fix('*');</script>
<![endif]-->
<title></title>
</head>
<body>
<nav class="breadcrumb"><i class="Hui-iconfont">&#xe67f;</i> 首页
	<span class="c-gray en">&gt;</span>
	日志
	<span class="c-gray en">&gt;</span>
	工作日志
	<a class="btn btn-success radius r" style="line-height:1.6em;margin-top:3px" href="javascript:location.replace(location.href);" title="刷新" ><i class="Hui-iconfont">&#xe68f;</i></a>
</nav>
<div class="page-container">
	<form action="/workLog" method="post">
		<div class="text-c">
			项目名称:
			<input type="text" class="input-text"  name="project" style="width:150px" th:value="${project}">
			日期:
			<input type="date" class="input-text" name="workdate" style="width:150px" th:value="${#dates.format(workdate,'yyyy-MM-dd')}">
			<button type="submit" class="btn btn-primary radius" id="" name=""><i class="Hui-iconfont">&#xe665;</i> 查询</button>
		</div>
	</form>
	<div class="cl pd-5 bg-1 bk-gray mt-20">
		<span class="l">
		<a href="javascript:;" onclick="worklog_add('增加','worklog-add','700','800')" class="btn radius"><i class="Hui-iconfont Hui-iconfont-add2"></i> 增加</a>
		<a href="javascript:;" onclick="worklog_del()" class="btn radius"><i class="Hui-iconfont Hui-iconfont-del3"></i> 删除</a>
		<!--<a href="javascript:;" onclick="" class="btn radius"><i class="Hui-iconfont Hui-iconfont-edit"></i> 编辑</a>-->
		<!--<a href="javascript:;" onclick="" class="btn  radius"><i class="Hui-iconfont Hui-iconfont-search2"></i> 查看</a>-->
		</span>
	</div>
	<div class="mt-20">
		<table class="table table-border table-bordered table-bg table-hover table-sort">
			<thead>
				<tr class="text-c">
					<th width="10"><input type="checkbox" ></th>
					<th width="200">记录人员</th>
					<th width="200">记录日期</th>
					<th width="50" >操作</th>
				</tr>
			</thead>
			<tbody>
				<tr class="text-c" th:each="work : ${workLogs}">
					<td><input type="checkbox" th:value="${work.worklog.id}" name="id" th:onclick="'javascript:check(\''+${work.worklog.id}+'\',event)'"></td>
					<td th:text="${work.user.name}"></td>
					<td th:text="${#dates.format(work.worklog.uptime,'yyyy-MM-dd HH:mm:ss')}"></td>
					<td>
						<a href="javascript:;"  th:onclick="'javascript:worklog_view(\''+${work.worklog.id}+'\')'" class="layui-btn layui-btn-xs"><i class="Hui-iconfont Hui-iconfont-search2"></i>查看</a> &nbsp;&nbsp;
						<a href="javascript:;"  th:onclick="'javascript:worklog_edit(\''+${work.worklog.id}+'\')'" class="layui-btn layui-btn-xs"><i class="Hui-iconfont Hui-iconfont-edit"></i> 编辑</a>
					</td>
				</tr>
			</tbody>
		</table>
	</div>
</div>
<!--_footer 作为公共模版分离出去-->
<script type="text/javascript" src="lib/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript" src="lib/layer/2.4/layer.js"></script>
<script type="text/javascript" src="static/h-ui/js/H-ui.min.js"></script>
<script type="text/javascript" src="static/h-ui.admin/js/H-ui.admin.js"></script> <!--/_footer 作为公共模版分离出去-->

<!--请在下方写此页面业务相关的脚本-->
<script type="text/javascript" src="lib/My97DatePicker/4.8/WdatePicker.js"></script>
<script type="text/javascript" src="lib/datatables/1.10.0/jquery.dataTables.min.js"></script>
<script type="text/javascript" src="lib/laypage/1.2/laypage.js"></script>
<script type="text/javascript">
$('.table-sort').dataTable({
	"bFilter": false,//过滤功能
	"bPaginate": true,//翻页信息
	"bInfo": true,//数量信息
	"bStateSave": true,//状态保存
	"aoColumnDefs": [
	  //{"bVisible": false, "aTargets": [ 3 ]} //控制列的隐藏显示
	  {"orderable":false,"aTargets":[0,1]}// 制定列不参与排序
	]
});

function worklog_add(title,url,w,h){
  layer_show(title,url,w,h);
}

var  ids = [];
function check(id,e){
    if(e.target.checked){//如果是被选中,则增加到数组
        ids.push(id);
    }else{
        var idx = ids.indexOf(id);
        ids.splice(idx, 1);//删除
    }
}
function worklog_del(){
   var t = confirm("确认删除吗")
    if (t){
        var ids = [];
        $("input[type='checkbox']:not(:first)").each(function(){
            if($(this).is(":checked")){
                ids.push($(this).val())
            }else{
            }
        });
        if (!ids.length<1){
            $.ajax({
                type: "POST",
                url: "/delWorkLog?ids="+ids,
                success:function (data) {
                    if (data=="200") {
                        layer.msg("删除成功！",{icon:1,time:2000})
                        setTimeout(function () {
                            window.location.reload();
                        },2000)
                    }
                },
                error: function (error) {
                    parent.layer.msg("删除失败！",{icon:1,time:2000})
                }
            });
        }
        return false;
    }
}


function worklog_view(id){
    layer.open({
        type: 2,
        title: "查看",
        shadeClose: false,
        shade: [0.3],
        maxmin: true, //开启最大化最小化按钮
        area: ['900px', '60%'],
        scrollbar: false, //屏蔽滚动条
        content: "worklog_view?id="+id,
    });
}
function worklog_edit(id){
    layer.open({
        type: 2,
        title: "编辑",
        shadeClose: false,
        shade: [0.3],
        maxmin: true, //开启最大化最小化按钮
        area: ['900px', '80%'],
        scrollbar: false, //屏蔽滚动条
        content: "worklog_edit?id="+id,
    });
}
</script>
</body>
</html>